#!/bin/bash

# 更新软件包索引
sudo yum update -y

# 安装lrzsz上传文件
sudo yum install -y lrzsz

# 安装网络工具ifconfig
sudo yum install -y net-tools

# 安装 wget
sudo yum install -y wget
echo "wget install finished!"

# 安装 openssl
sudo yum install -y openssl

# 安装 vim
sudo yum install -y vim
echo "vim install finished!"

# 安装 docker
sudo yum install -y docker
sudo systemctl start docker
sudo systemctl enable docker
# 配置docker镜像源
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://10c3pvm2.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
echo "docker install finished!"

# 安装 Java 8
sudo yum install -y java-1.8.0-openjdk-devel
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk" | sudo tee -a /etc/profile
echo "export PATH=\$JAVA_HOME/bin:\$PATH" | sudo tee -a /etc/profile
source /etc/profile
echo "jdk安装完成 install finished!"
java_version=${java -version}
echo "java version: $java_version}"

